// 云函数入口文件
const cloud = require("wx-server-sdk");
cloud.init();
const db = cloud.database();

// 查找相应的用户数据
exports.main = async (event, context) => {
    if (!event.UserOpenId) return false;
    return db
        .collection("User")
        .doc(event.UserOpenId)
        .get()
        .then((res) => {
            if (res && res.data) {
                return res.data.isManager;
            } else {
                return false;
            }
        })
        .catch(() => false);
};
